package action.agent;

import org.apache.struts2.ServletActionContext;

import service.interf.IIfwAgentDevInfo;
import service.interf.IIfwCardInfo;
import action.common.MyBaseAction;

import com.opensymphony.xwork2.ModelDriven;

import dao.interf.IIfwAgentDevInfoDAO;
import dao.interf.IIfwCardInfoDAO;
import dao.pojo.IfwAgentDevInfo;
import dao.pojo.IfwCardInfo;

public class IfwCardInfoAction extends MyBaseAction<IfwCardInfo> implements ModelDriven<IfwCardInfo> {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public IfwCardInfoAction() {
		super(IfwCardInfo.class);
	}
	public IfwCardInfo getModel() {
		return model;
	}
	private IIfwCardInfo iIfwCardInfo;
	private IIfwCardInfoDAO iIfwCardInfoDAO;
	
	public IIfwCardInfo getiIfwCardInfo() {
		return iIfwCardInfo;
	}
	public void setiIfwCardInfo(IIfwCardInfo iIfwCardInfo) {
		this.iIfwCardInfo = iIfwCardInfo;
	}
	public IIfwCardInfoDAO getiIfwCardInfoDAO() {
		return iIfwCardInfoDAO;
	}
	public void setiIfwCardInfoDAO(IIfwCardInfoDAO iIfwCardInfoDAO) {
		this.iIfwCardInfoDAO = iIfwCardInfoDAO;
	}
	/**
	 * 初始化列表
	 */
	public void getlist() {
		String x = "";
		try {
			x = iIfwCardInfo.findByProperty("IfwCardInfo", "*", "json", true, null, null,
					null, null, model.getPage(), model.getRows());	
		} catch (Exception e) {
			x = errorHandle.handleErr(e);
		}
		servletHandle.writeToClient(ServletActionContext.getResponse(), x);
	}
	/**
	 * 充值点卡
	 */
	public void addInCafe() {
		String x = "";
		try {
			x = iIfwCardInfo.addCard(model);
		} catch (Exception e) {
			x = errorHandle.handleErr(e);
		}
		servletHandle.writeToClient1(ServletActionContext.getResponse(), x);
	}
	/**
	 * 查询--ID
	 */
	public void findbyId() {
		String x = "";
		try {
			x = iIfwCardInfo.findByProperty("IfwCardInfo", "*", "json", true, new String[]{"cardIndex"}, new Object[]{model.getCardIndex()},
					null, null, model.getPage(), model.getRows());	
		} catch (Exception e) {
			x = errorHandle.handleErr(e);
		}
		servletHandle.writeToClient1(ServletActionContext.getResponse(), x);
	}
}
